﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FonShare.Classes.FTP
{
    /// <summary>
    /// Manage information about FTPFile.
    /// </summary>
    /// <author>spesme</author>
    /// <since>24/06/2009</since>
    public static class FS_FTPFileManager
    {
        /// <summary>
        /// Transform file information from ftp server to FTPfile object.
        /// </summary>
        /// <param name="p_filesList">The p_files list.</param>
        /// <returns></returns>
        /// <author>spesme</author>
        /// <since>24/06/2009</since>
        public static List<FS_FTPFile> GetFiles(string[] p_filesList, string p_folder)
        {
            List<FS_FTPFile> result = new List<FS_FTPFile>();
            FS_FTPFile currentFTPFile = null;
            foreach (string currentFile in p_filesList)
            {
                if (!string.IsNullOrEmpty(currentFile))
                {
                    currentFTPFile = new FS_FTPFile(currentFile, p_folder);
                    result.Add(currentFTPFile);
                }
            }
            return result;
        }
    }
}
